Skip to content

feat(license): inject X-Axonflow-Client header on every governed request#180

Merged
saurabhjain1592 merged 3 commits intomainfrom
license/x-axonflow-client-header
May 5, 2026
Merged

feat(license): inject X-Axonflow-Client header on every governed request#180
saurabhjain1592 merged 3 commits intomainfrom
license/x-axonflow-client-header

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

Per ADR-050 §4, every governed client must set X-Axonflow-Client: <client-id>/<version> on every request to the agent.

This is the sdk-python half of getaxonflow/axonflow-enterprise#1881.

Changes

  • axonflow/client.py::__init__ — adds X-Axonflow-Client: sdk-python/<__version__> to the AsyncClient constructor headers. Every request shipped through _http_client now carries the header.
  • tests/test_client_header.py — new test (2 assertions: forwarded on proxy_llm_call + format check).

Verification

  • pytest tests/test_client_header.py — 2 / 2 passing
  • pytest tests/ --no-cov — 964 passed, 29 skipped, 1 pre-existing failure on test_telemetry_short_lived.py::test_telemetry_flushes_on_immediate_exit that also fails on origin/main (atexit flush flake, unrelated to this change).

Per ADR-050 §4, every governed client must set
`X-Axonflow-Client: <client-id>/<version>` on every request to the agent
so the agent can derive request scope (sdk) and validate it against the
token's aud.scope via HasScope().

Adds the header alongside the existing User-Agent in the AsyncClient
constructor. Value sourced from the bundled __version__ constant; no
env override (the consumer doesn't get to spoof its own client identity
to the agent).

Test coverage:
- tests/test_client_header.py asserts the header is forwarded on
  proxy_llm_call requests and matches the agent-parseable
  "<client-id>/<semver>" contract.

Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
…der injection

Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
@saurabhjain1592 saurabhjain1592 merged commit 6e29753 into main May 5, 2026
18 checks passed
@saurabhjain1592 saurabhjain1592 deleted the license/x-axonflow-client-header branch May 5, 2026 01:26
saurabhjain1592 added a commit that referenced this pull request May 6, 2026
…se validation [skip-runtime-e2e] (#182)

Companion release to platform v7.7.0. The Python SDK now sends
X-Axonflow-Client: sdk-python/<version> on every governed request, which
the agent (v7.7.0+) uses to derive SDK request scope and validate
against any license token's audience claim per the ADR-050 license
matrix.

Single substantive change since v7.0.0 (#180 — header injection).
Supporting commits since v7.0.0 (DCO sign-off docs, definition-of-done
CI gate, v7.0.0 changelog typo correction) are infrastructure and not
user-facing.

No public API changes. Existing v7.0.x callers pip install --upgrade
axonflow and rebuild against v7.7.0 with no source changes.

Backward-compatible against pre-v7.7.0 agents (header silently dropped).

[skip-runtime-e2e] — version + CHANGELOG bump only; the underlying
header behavior shipped + was runtime-tested when #180 landed.

Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
saurabhjain1592 added a commit that referenced this pull request May 6, 2026
…[skip-runtime-e2e] (#183)

Companion to axonflow-sdk-go fix PR #156. The previous release PR (#182)
bumped the Python SDK from v7.0.0 directly to v7.7.0 to platform-align
with the V1 SaaS Plugin Pro launch. That was incorrect semver — the only
substantive change since v7.0.0 is the X-Axonflow-Client header injection
(one minor feature) so the natural bump is v7.1.0, not v7.7.0.

Updates:
- pyproject.toml + axonflow/_version.py 7.7.0 → 7.1.0
- CHANGELOG header [7.7.0] → [7.1.0], 2026-05-06 stamp preserved
- Sister SDK cross-references (Go / TypeScript / Java) updated to v7.1.0
- Existing v7.0.x callers rebuild against v7.1.0

Platform v7.7.0 references in the same CHANGELOG entry are kept — those
are correctly the platform version, not the SDK version.

[skip-runtime-e2e] — version-correction only; no behavior change since
the header injection runtime contract was already validated when #180
landed and re-confirmed when #182 merged.

Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant